package pl.edu.agh.neuraleconomy.ui.component;

import lombok.Getter;

import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

public abstract class LinkLabel<MODEL> extends Label{
	
	@Getter
	private MODEL object;

	public LinkLabel(Composite arg0, int arg1, MODEL object) {
		super(arg0, arg1);
		this.object = object;
		this.addMouseListener(new MouseAdapter() {

			@Override
			public void mouseDown(MouseEvent arg0) {
				onClick(getObject());
			}
		});
	}
	
	protected abstract void onClick(MODEL object);
	
	@Override
	protected void checkSubclass() {
	}

}
